package com.cloud.logger.zchain.zchainserver.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.cloud.logger.zchain.zchainserver.entity.propertyenum.SwitchEnum;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * User: wcy
 * Date: 2017/4/20
 * Time: 9:36
 */
@Data
@Document(collection = "logger_project")
public class AngelaLoggerProject{

    @Id
    private String id;

    //父节点（如果是根节点为-1）
    @JsonProperty("parent_node")
    @JSONField(name = "parent_node")
    @ApiModelProperty(name = "parent_node", notes = "父节点（如果是根节点为-1）", example = "-1")
    @NotBlank(message ="parentNode字段不能为空")
    private String parentNode;
    @JsonProperty("name")
    @JSONField(name = "name")
    @ApiModelProperty(name = "name", notes = "名称", example = "1")
    @NotBlank(message ="name字段不能为空")
    private String name;

    @JsonProperty("code")
    @JSONField(name = "code")
    @ApiModelProperty(name = "code", notes = "编码", example = "1")
    @NotBlank(message ="code字段不能为空")
    private String code;

    @JsonProperty("ip")
    @JSONField(name = "ip")
    @ApiModelProperty(name = "ip", notes = "安装ip地址", example = "1")
    private String ip;

    @JsonProperty("path")
    @JSONField(name = "path")
    @ApiModelProperty(name = "path", notes = "安装路径", example = "1")
    private String path;

    @JsonProperty("start_time")
    @JSONField(name = "start_time")
    @ApiModelProperty(name = "start_time", notes = "开始时间", example = "")
    private String startTime;

    @JsonProperty("shut_down_time")
    @JSONField(name = "shut_down_time")
    @ApiModelProperty(name = "shut_down_time", notes = "结束日期", example = "")
    private String shutDownTime;

    @JsonProperty("status")
    @JSONField(name = "status")
    @ApiModelProperty(name = "status", notes = "项目情况(off/on)", example = "off")
    private SwitchEnum status;

    @JsonProperty("message_remind")
    @JSONField(name = "message_remind")
    @ApiModelProperty(name = "message_remind", notes = "短信提醒(off/on)", example = "off")
    private SwitchEnum messageRemind;

    @JsonProperty("mail_remind")
    @JSONField(name = "mail_remind")
    @ApiModelProperty(name = "mail_remind", notes = "邮件提醒(off/on)", example = "off")
    private SwitchEnum mailRemind;

    @Transient
    private List<AngelaLoggerProject> children;

    @Transient
    @ApiModelProperty(name = "status", notes = "项目生存情况", example = "（3/2）")
    private String statusStr;

    @ApiModelProperty(hidden = true)
    @JsonProperty("created_date")
    @JSONField(name = "created_date", format = "yyyy-MM-dd HH:mm:ss")
    private Date createdDate;
    @ApiModelProperty(hidden = true)
    private long version;
    @ApiModelProperty(hidden = true)
    private long createBy;

}
